From 6069fe14441c9843fdd21fce66047aae258d30f1 Mon Sep 17 00:00:00 2001 From: Matt Brubeck Date: Mon, 2 Nov 2015 11:32:26 -0800 Subject: [PATCH] Expand documentation on integration tests --- src/doc/manifest.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/doc/manifest.md b/src/doc/manifest.md index d30001fef..cebdee061 100644 --- a/src/doc/manifest.md +++ b/src/doc/manifest.md @@ -428,11 +428,22 @@ When you run `cargo test`, Cargo will: `lib.rs`. Any sections marked with `#[cfg(test)]` will be included. * Compile and run your library’s documentation tests, which are embedded inside of documentation blocks. -* Compile and run your library's integration tests, which are located in - `tests`. Files in `tests` load in your library by using `extern crate - ` like any other code that depends on it. +* Compile and run your library's [integration tests](#integration-tests). * Compile your library's examples. +## Integration tests + +Each file in `tests/*.rs` is an integration test. When you run `cargo test`, +Cargo will compile each of these files as a separate crate. The crate can link +to your library by using `extern crate `, like any other code +that depends on it. + +Cargo will not automatically compile files inside subdirectories of `tests`, +but an integration test can import modules from these directories as usual. +For example, if you want several integration tests to share some code, you can +put the shared code in `tests/common/mod.rs` and then put `mod common;` in +each of the test files. + # Configuring a target All of the `[[bin]]`, `[lib]`, `[[bench]]`, and `[[test]]` sections support -- 2.30.2